package 笔试.贝壳;

import java.util.Scanner;

public class Demo11 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt(); //组数
        int[] count = new int[T];
        //int[] dp = new int[1000001];
        // Arrays.fill(dp,1);
        //for (int i = 2; i < dp.length ; i++) {
        // dp[i] = hasCount(i);
        //}
//        dp[6] = 3;
//        dp[7] = 3;
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            count[i] = hasCount(n);
        }
        for (int t:count) {
            System.out.println(t);
        }
        sc.close();
    }

    public static int hasCount(int n){
        int i = 1;
        int j = n;
        int tmp = i+j;
        int count = 0;
        while(i<j){
            if(i+j==tmp){
                count++;
            }
            i++;
            j--;
        }
        return count;
    }
}
